<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<title>日志查询</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet"
	href="<%=basePath%>js/bootstrap-3.3.7-dist/css/bootstrap.min.css">
<link rel="stylesheet" href="<%=basePath%>css/init.css">
<style type="text/css">
.countTotal{
	margin-top: -50px;
    float: right;
    line-height: 28px;
    border: 1px #DDDDDD solid;
    border-radius: 3px;
    color: #337AB7;
}
</style>
</head>
<body>

	<nav class="navbar navbar-default navbar-fixed-top">
		<div class="col-md-8 col-sm-offset-2 text-center">
			<%@include file="/WEB-INF/jsp/public/token.jsp" %>
			<form class="navbar-form navbar-center" role="search" id="searchForm"
				method="post" action="<%=basePath%>log/list">
				<input type="hidden" name="pageNum" value="${Page.pageNum}"/>
	 		    <div class="form-group">
                       <select id="opType" name="opType" class="show-tick form-control">
                       <c:if test="${opType==null || opType=='' }">
                           <option value="" selected="selected">全部</option>
                           <option value="edit">编辑数据</option>
                           <option value="del">删除数据</option>
                       </c:if>
                       <c:if test="${opType!=null && opType=='edit' }">
                       		<option value="">全部</option>
                            <option value="edit" selected="selected">编辑数据</option>
                            <option value="del">删除数据</option>
                       </c:if>
                       <c:if test="${opType!=null && opType=='del' }">
                       		<option value="">全部</option>
                            <option value="edit">编辑数据</option>
                            <option value="del" selected="selected">删除数据</option>
                       </c:if>
                       </select>
                </div>
				<div class="form-group">
					<input type="text"  id="statDate" name="statDate" class="Wdate" onClick="WdatePicker({maxDate:'#F{$dp.$D(\'endDate\')}'})"  style="height:34px;border-radius:3px"
						value="${statDate}" placeholder="开始日期">
					<input type="text"  id="endDate" name="endDate" class="Wdate" onClick="WdatePicker({minDate:'#F{$dp.$D(\'statDate\')}'})"  style="height:34px;border-radius:3px"
						value="${endDate}" placeholder="结束日期">
				</div>
				<button type="button" id="searchBtn" class="btn btn-default">搜索</button>
			</form>
		</div>
		<div class="text-center init-login">
			<a href="<%=basePath%>sign/list" class="btn btn-primary" role="button"><span class="glyphicon glyphicon-home" aria-hidden="true">返回首页</a>
		</div>
	</nav>
	<div class="container">
		<div class="container-fluid" style="margin-top: 85px;">
			<div class="table-responsive">
				<table class="table table-hover">
					<thead>
						<tr>
							<th>序号</th>
							<th>操作Ip</th>
							<th>操作用户</th>
							<th>操作功能</th>
							<th>操作时间</th>
							<th>操作类型</th>
							<th>被更新人</th>
							<th>更新数据</th>
						</tr>
					</thead>
					<tbody>
						<c:forEach items="${SysLogList}" var="VO" varStatus="status">
							<tr>
								<td>${status.index+1}</td>
								<td>${VO.opIp}</td>
								<td>${VO.opUserName}</td>
								<td>${VO.opFunctionUrl}</td>
								<td><fmt:formatDate type="both"  value="${VO.opDate}" /></td>
								<td>${VO.opType}</td>
								<td>${VO.opEditName}</td>
								<td>${VO.opEditData}</td>
							</tr>
						</c:forEach>
						<c:if test="${SysLogList==null || SysLogList.size()==0}">
							<tr>
								<td colspan="8">暂无数据</td>
							</tr>
						</c:if>
					</tbody>
				</table>
			</div>
		</div>
		<div> 
			<div id="paginarorDiv" style="text-align: right;margin-right: 50px;"></div>
			<div class="countTotal">
				<c:if test="${Page.total !=0}">
					共${Page.total}条
				</c:if>
			</div>
		</div>
	</div>	
<script src="<%=basePath%>js/jquery-2.1.1/jquery.min.js"></script>
<script src="<%=basePath%>js/bootstrap-3.3.7-dist/js/bootstrap-paginator.min.js"></script>
<script src="<%=basePath%>js/bootstrap-3.3.7-dist/js/bootstrap.min.js"></script>
<script src="<%=basePath%>js/My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript">
function pageChangedEvent()
{
    var options = {
        currentPage: '${Page.pageNum}',
        totalPages: '${Page.pages}',
        numberOfPages:10,
        itemTexts: function (type, page, current) {
            switch (type) {
                case "first":
                    return "首页";
                case "prev":
                    return "上一页";
                case "next":
                    return "下一页";
                case "last":
                    return "末页";
                case "page":
                    return page;
            }
        },
        pageUrl: function(type, page, current){
        	var statDate=$("#statDate").val();
        	var endDate=$("#endDate").val();
        	var paramUrl='&statDate='+statDate+'&endDate='+endDate;
        	return '<%=basePath%>log/list?pageNum='+page+paramUrl;
        }
    }
    $('#paginarorDiv').bootstrapPaginator(options);
}   
$(function(){
	$("#searchBtn").click(function(){
		$('#searchForm').submit();
	});
	$("#clearBtn").click(function(){
		$('#statDate').val("");
		$('#endDate').val("");
	});
    pageChangedEvent();
})
</script>
</body>
</html>
